'use strict'

function Person(name) {
    this.name = name || 'unName';
    this.think = function () {
        console.log("I'm thinking!");
    }
}

var xiaor = new Person('xiaor');

console.log(xiaor.name);
xiaor.think();

function Student(props) {
    this.name = props.name || '匿名';
    this.grade = props.grade || 1;
}

function createStudent(props) {
    return new Student(props || {});
}

var xiaohong = createStudent({
    name: 'xiaohong'
});

console.log(xiaohong.name);
console.log(xiaohong);

console.log(xiaor.__proto__ === Person.prototype);

class Humen {
    constructor(name) {
        this.name = name;
    }
    think() {
        console.log(this.name + ' is thinking!');
    }
}

class Woman extends Humen {
    constructor(name, cupSize) {
        super(name);
        this.cupSize = cupSize;
    }

    showSize() {
        console.log(this.name + "'s cupsize is " + this.cupSize);
    }
}

var superman = new Humen('xiaor');

var xiaoyueyue = new Woman('xiaoyueyue', 'E');

console.log(superman.think());
console.log(xiaoyueyue.showSize());

console.log(global);